package 设计模式.创建型.单例;

/**
 * 饿汉式
 * @author lchenglong
 * @date 2024/1/26
 */
public class Singleton2 {
    private static Singleton2 instance;

    public static synchronized Singleton2 getInstance() {
        if (instance == null){
            instance = new Singleton2();
        }
        return instance;
    }

}
